"""
    Controller for trend dictionary table.
"""

from mnemoply import model
from mnemoply.controllers.lookup import LookupController, TableCol, TableLookupDataSource
from mnemoply.controllers.crud import CRUDController

class TrendController(LookupController, CRUDController):
    model_object = model.Trend
    lookup_columns = [
        TableCol(name='name', caption=_('Name')),
        TableCol(name='one_char', caption=_('Letter')),
        TableCol(name='faculty', caption=_('Faculty')),
        TableCol(name='payment_type', caption=_('Payment type')),
        TableCol(name='comment', caption=_('Comment'), hidden=True),
        ]
    edit_fields = ['name', 'oneChar', 'comment','facultyID','paymentTypeID']
    view_fields = edit_fields

    def __init__(self):
        LookupController.__init__(self,
            data_source=TableLookupDataSource('trend_lookup'),
            columns=self.lookup_columns,
            mass_actions_class=self.model_object,
            title=self.model_object.model_title,
        )
        CRUDController.__init__(self, model_object=self.model_object)

exposed = TrendController()
